import { createRouter, createWebHashHistory } from "vue-router";

const routes = createRouter({
  history: createWebHashHistory(),
  routes: [
    {
      path: "/",
      name: "",
      component: () => import("../layout/index.vue"),

      redirect: "/chats",

      children: [
        {
          path: "/chats",
          name: "chats",
          component: () => import("../view/chats.vue"),
        },
        {
          path: "/connect",
          name: "connect",
          component: () => import("../view/connect.vue"),
        },
        {
          path: "/user",
          name: "user",
          component: () => import("../view/user.vue"),
        },
      ],
    },

    {
      path: "/login",
      name: "login",
      component: () => import("../view/login.vue"),
    },

    {
      path: "/search/:type",
      name: "search",
      component: () => import("../view/search.vue"),
    },

    {
      path: "/require",
      name: "require",
      component: () => import("../view/require.vue"),
    },

    {
      path: "/chatsDetail/:roomId & :roomName & :type",
      name: "chatsDetail",
      component: () => import("../view/chastDetail.vue"),
    },

    {
      path: "/groupDetail",
      name: "groupDetail",
      component: () => import("../view/groupDetail.vue"),
    },

    {
      path: "/starList",
      name: "starList",
      component: () => import("../view/starList.vue"),
    },
  ],
});

export default routes;
